# 登录页
from time import sleep

from dim_web_auto_test.page.base_page.base_page import BasePage
from setting import *
from tools.browser import CHROME


class LoginPage(BasePage):
    url = SIT_DIM_URL
    driver = CHROME().browser
    page_elements = YAML_ELEMENT

    def login(self, username: str = USERNAME, password: str = PASSWORD):
        self.get(self.url)
        self.send_keys("login_page.username_loc", username)
        self.send_keys("login_page.password_loc", password)
        self.click("login_page.login_btn")

    def quit_browser(self):
        self.quit()


if __name__ == "__main__":
    test = LoginPage()
    test.login()
